package com.gxc.blogm.util;

import java.util.List;

import com.gxc.blogm.domain.Bulletin;
import com.gxc.blogm.service.CacheService;
import com.gxc.webcore.util.ContextUtil;

/**
 * 博客缓存
 * 
 * @author gxc
 * 
 */
public class Cache {

	/**
	 * 缓存-公告
	 */
	public static Bulletin bulletin;

	/**
	 * 文章分类缓存
	 */
	public static List<?> articleSortList;

	/**
	 * 文章归档缓存
	 */
	public static List<?> articleArchiveList;

	/**
	 * 友情链接
	 */
	public static List<?> frendlinkList;

	private void updateCache() {
		CacheService cacheService = (CacheService) ContextUtil
				.getBean("blogCacheService");
		cacheService.reload();
	}

	public Bulletin getBulletin() {
		if (bulletin == null) {
			this.updateCache();
		}
		return bulletin;
	}

	@SuppressWarnings("rawtypes")
	public List getArticleSortList() {
		if (articleSortList == null) {
			this.updateCache();
		}
		return articleSortList;
	}

	@SuppressWarnings("rawtypes")
	public List getArticleArchiveList() {
		if (articleArchiveList == null) {
			this.updateCache();
		}
		return articleArchiveList;
	}

	@SuppressWarnings("rawtypes")
	public List getFrendlinkList() {
		if (frendlinkList == null) {
			this.updateCache();
		}
		return frendlinkList;
	}

}
